import uuid
from datetime import datetime
from flask import request, current_app
# from server.app_flask import app
# from server.database import db
from server.model.user import User


class UserService(object):
    # @staticmethod
    # def add_user(data):
    #     db = current_app.extensions['sqlalchemy'].db
    #     data = request.get_json()
    #     print(data)
    #     user = User(id=uuid.uuid4(), name=data['name'], email=data['email'], password=data['password'], register_time=datetime.now())
    #     db.session.add(user)
    #     try:
    #         db.session.commit()
    #     except Exception as e:
    #         db.session.rollback()
    #         print(e)

    @staticmethod
    def select_all():
        result = User.query.all()
        return result


